package org.sction.bean;

import java.util.List;
import java.util.TreeMap;

import org.apache.poi.ss.usermodel.Workbook;
import org.sction.manager.file.SimpleToExcelRender;
import org.sction.manager.file.ToExcelRender;


/**
 * @author 作者 : Administrator
 * @version 创建时间：2013-8-11 下午2:39:45
 * 
 *          类说明
 */
public class ExcelBean {
	private Workbook wb;
	boolean xlsx = false;
	private String name = "";
	private String nameEncoding = "UTF-8";
	private TreeMap<String, List<List<ExcelCellBean>>> sheets = new TreeMap<String, List<List<ExcelCellBean>>>();
	private ToExcelRender toExcelRender = new SimpleToExcelRender();

	public ExcelBean(String name, boolean isXlsx) {
		this.xlsx = isXlsx;
		if (name == null || name.trim().equals("")) {
			this.name = "未命名" + (xlsx ? ".xlsx" : ".xls");
		} else {
			this.name = name + (xlsx ? ".xlsx" : ".xls");
		}
	}

	public ExcelBean(String name) {
		if (name == null || name.trim().equals("")) {
			this.name = "未命名.xls";
		} else {
			this.name = name + ".xls";
		}
	}

	public TreeMap<String, List<List<ExcelCellBean>>> getSheets() {
		return sheets;
	}

	public void setSheets(TreeMap<String, List<List<ExcelCellBean>>> sheets) {
		this.sheets = sheets;
	}

	public ToExcelRender getToExcelRender() {
		return toExcelRender;
	}

	public void setToExcelRender(ToExcelRender toExcelRender) {
		this.toExcelRender = toExcelRender;
	}

	public Workbook getWb() {
		return wb;
	}

	public void setWb(Workbook wb) {
		this.wb = wb;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getNameEncoding() {
		return nameEncoding;
	}

	public void setNameEncoding(String nameEncoding) {
		this.nameEncoding = nameEncoding;
	}

	public void putSheet(String name, List<List<ExcelCellBean>> data) {
		sheets.put(name, data);
	}

	public boolean isXlsx() {
		return xlsx;
	}

	public void setXlsx(boolean xlsx) {
		this.xlsx = xlsx;
	}

}
